#include "stdafx.h"
#include "src\game\Game.h"
#include "src\gsm\ai\bots\LifeBarBot.h"
#include "src\gsm\state\GameStateManager.h"
#include "src\gsm\physics\Physics.h"

LifeBarBot::LifeBarBot()
{
	HP_Counter = 0;
	Life_states = new vector<wstring>();
	Life_states->push_back(L"HIT_100");
	Life_states->push_back(L"HIT_90");
	Life_states->push_back(L"HIT_80");
	Life_states->push_back(L"HIT_70");
	Life_states->push_back(L"HIT_60");
	Life_states->push_back(L"HIT_50");
	Life_states->push_back(L"HIT_40");
	Life_states->push_back(L"HIT_30");
	Life_states->push_back(L"HIT_20");
	Life_states->push_back(L"HIT_10");
	Life_states->push_back(L"HIT_0");
	current_HP_state = Life_states->at(HP_Counter);
}
LifeBarBot::~LifeBarBot()
{

}

void LifeBarBot::ChangeToNextState(Game *game)
{
	HP_Counter++;
	current_HP_state = Life_states->at(HP_Counter);
	if(HP_Counter==10)
		game->getGSM()->getSpriteManager()->getLP()->ChangeToNextState();

	this->setCurrentState(current_HP_state);
}
// UPDATE HP INFO
void LifeBarBot::think(Game *game)
{
	Viewport *viewport = game->getGUI()->getViewport();
	PhysicalProperties *pp = this->getPhysicalProperties();
	pp->setPosition(viewport->getViewportX()+10.0,viewport->getViewportY()+40.0);
}

Bot* LifeBarBot::clone()
{
	LifeBarBot *botClone = new LifeBarBot();
	return botClone;
}
